<?php
class Model_LibraryAcl extends Zend_Acl{
    public function __construct(){
        $this->add(new Zend_Acl_Resource('index'));
        $this->add(new Zend_Acl_Resource('editarindex'),'index');
        
        $this->add(new Zend_Acl_Resource('error'));
        
        $this->add(new Zend_Acl_Resource('nosotros'));
        
        $this->add(new Zend_Acl_Resource('noticias'));
        $this->add(new Zend_Acl_Resource('ver'),'noticias');
        $this->add(new Zend_Acl_Resource('agregar'),'noticias');
        $this->add(new Zend_Acl_Resource('listar'),'noticias');
        
        $this->add(new Zend_Acl_Resource('registrar'));
        $this->add(new Zend_Acl_Resource('registro'),'registrar');
        $this->add(new Zend_Acl_Resource('agregararea'),'registrar');
        $this->add(new Zend_Acl_Resource('listararea'),'registrar');
        $this->add(new Zend_Acl_Resource('agregarcarrera'),'registrar');
        $this->add(new Zend_Acl_Resource('listarcarrera'),'registrar');
        
        $this->add(new Zend_Acl_Resource('skins'));
        $this->add(new Zend_Acl_Resource('skin'),'skins');
        
        $this->add(new Zend_Acl_Resource('permiso'));
        $this->add(new Zend_Acl_Resource('imprimir'),'permiso');
        
        $this->add(new Zend_Acl_Resource('subir'));
        $this->add(new Zend_Acl_Resource('subirresumen'),'subir');
        $this->add(new Zend_Acl_Resource('subirvideo'),'subir');
        
        $this->add(new Zend_Acl_Resource('tesis'));
        
        $this->add(new Zend_Acl_Resource('usuarios'));
        $this->add(new Zend_Acl_Resource('login'),'usuarios');
        $this->add(new Zend_Acl_Resource('logout'),'usuarios');
        $this->add(new Zend_Acl_Resource('crearusuario'),'usuarios');
        
        $this->add(new Zend_Acl_Resource('administrar'));
        
        $this->addRole(new Zend_Acl_Role('guest'));
        $this->addRole(new Zend_Acl_Role('usuario'));
        $this->addRole(new Zend_Acl_Role('administrador'),'usuario');
            
        $this->allow(null,'login');
    
        $this->allow('guest',array('index','login','logout','tesis','nosotros','error','registrar'));
        $this->allow('guest','noticias','ver');
        $this->allow('guest','permiso','imprimir');
        $this->allow('usuario',array('index','login','logout','tesis','nosotros','error','registrar'));
        $this->allow('usuario','noticias','ver');
        $this->allow('usuario','usuarios','logout');
        $this->allow('usuario','subir','subirresumen');
        $this->allow('usuario','subir','subirvideo');
        $this->allow('administrador','usuarios');
        $this->allow('administrador','permiso');
        $this->allow('administrador','noticias');
        $this->allow('administrador','registrar');
        $this->allow('administrador','skins');
        $this->allow('administrador','subir');
        
    }
}